<template>
  <error-tip :errorCode="errorCode" v-if="errorCode" >

</error-tip>
  <div v-else class="year">
    <year-picture :data="yearData"></year-picture>
  </div>
</template>

<script>
import { getNewdata } from '@/lib/unit';
import getData from '@/service';
import { computed, onMounted } from 'vue';
import { useStore } from 'vuex';
import YearPicture from '@/components/YearPicture/YearPicture.vue';

export default {
  setup(){
 const store=useStore()
    onMounted(()=>{
      const field=store.state.field
      getData(field,getNewdata(field))
      
    })
    return {
    yearData:computed(()=>store.state.yearData),
    errorCode:computed(()=>store.state.errorCode)
    
  }
},
components:{
  YearPicture
}
}

</script>

<style lang="less" scoped>
    .year{
        padding: .82rem .44rem;
        box-sizing: border-box;
    }
</style>